package com.jkhan.demo.generic;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName Copy
 * @Description Copy
 * @Author hjk
 * @Date 2022/2/11 20:26
 **/
public class Copy {
    public static void main(String[] args) {
        Integer[] arr = new Integer[]{1, 2, 3, 5};
        List<Integer> list1 = copyFromArray(arr);

        System.out.println(list1);
    }

    public static <E> List<E> copyFromArray(E[] arr) {
        ArrayList<E> list = new ArrayList<>();

        for (E e : arr) {
            list.add(e);
        }

        return list;
    }
}
